﻿using LJX.SmartPark.Common.ResponseOutput;
using LJX.SmartPark.Domain.Base;
using LJX.SmartPark.Domain.IotInfo;
using LJX.SmartPark.Domain.IotInfo.SmartLamp;
using LJX.SmartPark.Service.IotInfo;
using LJX.SmartPark.Service.IotInfo.SmartLamp;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using static LJX.SmartPark.Service.IotInfo.SmartLamp.SmartLampService;

namespace LJX.SmartPark.WebApi.Controllers.IotInfo
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiExplorerSettings(GroupName = "IotInfo")]
    public class SmartLampController : ControllerBase
    {
        private readonly ISmartLampService  _smartLampService;
        public SmartLampController(ISmartLampService smartLampService)
        {
            _smartLampService = smartLampService;
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<bool>> PostAddSmartLamp(SmartLamp input)
        {
            var result = _smartLampService.SmartLampsAdd(input);
            return result;
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpDelete]
        public Task<Response<bool>> DeleteSmartLamp(SmartLamp input)
        {
            var result = _smartLampService.SmartLampsDelete(input);
            return result;
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<Response<bool>> PutUpdateSmartLamp(SmartLamp input)
        {
            var result = _smartLampService.SmartLampsUpdate(input);

            return result;

        }
        /// <summary>
        /// 显示
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpGet]
        public Response<List<SmartLamp>> GetSmartLampAsync()
        {
            var result = _smartLampService.GetSmartLampsAsync();
            return result.Result;
        }
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public Response<SmartLamp> GetSmartLampById(SmartLamp input)
        {
            var student = _smartLampService.GetSmartLampsData(input);
            return student;
        }
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<bool>> SmartLampsDeleteDatas(string[] ids)
        {
           
            return _smartLampService.SmartLampsDeleteDatas(ids);
        }
        /// <summary>
        /// 分页显示查询
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPost]
        public Response<List<SmartLamp>> GetSmartLampsPage(SelectLog select)
        {
            var result = _smartLampService.GetSmartLampsPage(select);
            return result.Result;
        }
        /// <summary>
        /// 获取总条数
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpGet]
        public int GetCount()
        {
            return _smartLampService.GetCount();
        }

    }
}
